#include<iostream>
using namespace std;
int main(){
	 int s=0,x,n,i,k;
	 cin>>x;
     do{
   	   k=x;
       while(k!=0){
        s+=k%10;
        k/=10;
      } 
      x--;
     }while(x!=0);
cout<<s<<endl;
return 0;
}
